- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 311
Fix issue with handling of failure during discard of metadata cache entries #5817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Context: | 
749a292    to
    eaa68ee      
    Compare
  
    eaa68ee    to
    6506417      
    Compare
  
    | if (entry_ptr->type->fsf_size) { | ||
| if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) | ||
| /* Note error but keep going */ | ||
| HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure fsf_size is set to 0 if this fails, since it gets passed to H5MM_xfree. Either set it here or initialize it to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or simply skip calling H5MM_xfree if fsf_size fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the call to H5MF_xfree below? If so, I added the (ret_value >= 0) for that case. A little hacky, but figured it was best to skip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment but looks good otherwise
| * it to indicate that it was removed. | ||
| */ | ||
| cache_ptr->entries_removed_counter++; | ||
| cache_ptr->last_entry_removed_ptr = entry_ptr; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any chance cache_ptr->last_entry_removed_ptr is pointing to something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to say no, but I didn't validate any of the comments here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comments
23d5be9    to
    717e3ed      
    Compare
  
    …ntries When discarding a metadata cache entry after flushing it, errors during the discard process could cause the library to skip calling the 'free_icr' callback for the entry. This could result in resource leaks and the inability of the cache to be fully flushed and closed due to issues such as pinned entries remaining in the cache. This has been fixed by noting errors during the discard process, but attempting to fully free a cache entry before signalling that an error has occurred. Fixes CVE-2025-7068
717e3ed    to
    58f5a6b      
    Compare
  
    
When discarding a metadata cache entry after flushing it, errors during the discard process could cause the library to skip calling the 'free_icr' callback for the entry. This could result in resource leaks and the inability of the cache to be fully flushed and closed due to issues such as pinned entries remaining in the cache. This has been fixed by noting errors during the discard process, but attempting to fully free a cache entry before signalling that an error has occurred.
Fixes CVE-2025-7068
Fixes #5578
Also fixes #4586
Important
Fixes resource leak issue in metadata cache discard process, addressing CVE-2025-7068 by ensuring proper cleanup in
H5Centry.c.H5C__flush_single_entry()inH5Centry.cwhere errors during discard could skipfree_icrcallback, causing resource leaks.H5C__discard_single_entry()to handle entry discard, ensuring cleanup even on errors.RELEASE.txtto include fix for CVE-2025-7068 and GitHub issue [BUG] Memory leaks inH5FL__mallocatsrc/H5FL.c:211:30#5578.This description was created by for 749a292. You can customize this summary. It will automatically update as commits are pushed.
 for 749a292. You can customize this summary. It will automatically update as commits are pushed.